package com.example.mvp.Ui.Activity;


import com.example.mvp.Model.BaseModel;
import com.example.mvp.Presenter.BasePresenter;
import com.example.mvp.View.BaseView;
import com.example.mvp.View.RxBaseView;

public abstract class BaseMvpActivity<V extends BaseView,M extends BaseModel,P extends BasePresenter<V,M>>
        extends BaseActivity {

    public P mPresenter;

    @Override
    protected void initData() {
        mPresenter=createPresenter();
        if (mPresenter!=null){
            mPresenter.bindView((V)this);
        }
        initEvent();

    }

    protected abstract void initEvent();


//    @Override
//    public void showProgressbar() {
//
//    }

    protected abstract P createPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter!=null){
            mPresenter.destoryView();
            mPresenter=null;
        }
    }
}

